<?php 
	include ("../../config/koneksi.php");
	$q = "select p.id_ppk,p.nama, j.jenis, p.alamat, p.keterangan from ppk p inner join jenis_ppk j on p.id_jenis = j.id_jenis order by id_ppk desc";
	$r = mysql_query($q);
	
	$content = "DAFTAR PPK DI KABUPATEN BERAU\n\nNO,NAMA PPK, JENIS PPK, ALAMAT, KETERANGAN\n";
	while ($data = mysql_fetch_array($r)) {
		$no++;
		$content .= "$no,$data[nama],$data[jenis],$data[alamat],$data[keterangan]\n";
	};

	header("Content-type: text/csv");
	header("Content-Disposition: attachment; filename=ppk.csv");
	header("Pragma: no-cache");
	header("Expires: 0");
	echo $content;
?>